export default function(refvalue) {
    return {
        mounted() {
            this.$Bus.$on('setMianScroll', this.handleSetMianScroll);
            this.$refs[refvalue].addEventListener('scroll', this.handleMainScroll);
        },
        beforeDestroy() {
            this.$Bus.$emit('mainScroll');
            this.$Bus.$off('setMianScroll', this.handleSetMianScroll);
            this.$refs[refvalue].removeEventListener('scroll', this.handleMainScroll);
        },
        methods: {
            handleMainScroll() {
                this.$Bus.$emit('mainScroll', this.$refs[refvalue])
            },
            handleSetMianScroll(scrollTop) {
                // console.log(this.$refs[refvalue], scrollTop);
                this.$refs[refvalue].scrollTop = scrollTop;
                // console.log(scrollTop)
            }
        }
    }
}